package com.qyhl.webtv.module_news.news.smallvideo.fragment;


import com.qyhl.webtv.commonlib.entity.news.NewsBean;

import java.util.List;

/**
 * Created by qyhl on 2017/12/6.
 */

public class SmallVideoFragmentPresenter implements SmallVideoFragmentContract.SVFragmentPresenter {
    private SmallVideoFragment mView;

    private SmallVideoFragmentModel mModel;

    public SmallVideoFragmentPresenter(SmallVideoFragment mView) {
        this.mView = mView;
        this.mModel = new SmallVideoFragmentModel(this);
    }

    @Override
    public void getDatas(String sectionId, String page) {
        mModel.getDatas(sectionId, page);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.showMessage(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            case 3:
                mView.showLog(msg);
                break;
            case 4:
                mView.setError(msg);
                break;
            case 5:
                mView.showMessage(msg);
                break;
            default:break;
        }
    }

    @Override
    public void setDatas(List<NewsBean> beanList, boolean isMore) {
        mView.setDatas(beanList, isMore);
    }
}
